package com.naihe.anderson.sms.widgets;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.widget.TextView;

import com.naihe.anderson.sms.R;

public class MyProgressDialog extends Dialog {

	TextView progressContent;
	String message;

	public MyProgressDialog(Context context, String message) {
		super(context, R.style.progressStyle);
		this.message = message;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.progress_dialog_layout);

		progressContent = (TextView) findViewById(R.id.progress_content);
		if(TextUtils.isEmpty(message)){
			message = getContext().getResources().getString(R.string.progress_text);
		}
		progressContent.setText(message);
		
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK ){
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}
	
}
